package com.gonsin.gview.common.auth;

import com.gonsin.base.exceptions.IResultCode;

import java.util.HashMap;
import java.util.Map;

public enum UserResultCode implements IResultCode {

    ADMIN_GROUP(10001, "管理员组无法删除"),       //
    GROUP_NOT_EMPTY(10002, "该组含有账户，无法删除"),    //
    GROUP_NOT_FOUND(10003, "查找不到用户组"),    //
    USER_NOT_FOUND(10004, "找不到用户"),    //
    USER_MESSAGE_NOT_FOUND(10005, "找不到该人员资料"),    //
    USER_EXIST(10006, "账户已存在，不能重复添加"),    //
    ROOT_USER(10007, "不能删除根管理员"),    //
    DEPARTMENT_NOT_FOUND(10008, "找不到该部门"),    //
    DEPARTMENT_NOT_BIND(10009, "该人员资料没有绑定人员，无法添加"),    //
    DEPARTMENT_SAME_NAME(10010, "部门名字不能重复"),    //
    DEPARTMENT_NOT_EMPTY(10011, "部门含人员信息不能删除"),    //
    MENU_ERROR(10012, "菜单项必须与edificeKey匹配"),    ///
    WX_API_ERROR(10013, "企业微信接口调用失败"),    ///
    SESSION_ERROR(10014, "Session错误"),    ///
    MENU_SAME_NAME(10015, "菜单名字不能重复"),    ///
    HOST_NOT_SET(10016, "IP或域名没有设置"),    ///
    USER_MESSAGE_HAD_BIND(10017, "该人员资料已被绑定"),    ///
    EDIFICE_NOT_FOUND(10018, "找不到该会务中心"),    ///
    DING_TALK_NOT_SET(10019, "钉钉消息未设置"),    ///
    GROUP_CANNOT_UPDATE(10020, "不允许修改该组"),    ///
    USER_INFO_NAME_ERROR(10021, "输入的人员名字有误"),    ///
    DING_TALK_FILE_NOTE_FOUND(10022, "钉钉文件不存在"),
    DING_TALK_CHECK_FILE_NOTE_FOUND(10022, "钉钉校验文件不存在"),

    QY_WECHAT_NOT_SET(10023, "企业微信消息未设置"),
    QY_WECHAT_FILE_NOTE_FOUND(10024, "企业微信文件不存在"),
    QY_WECHAT_CHECK_FILE_NOTE_FOUND(10025, "企业微信校验文件不存在"),
    QY_WECHAT_ACCESS_TOKEN_FAIL(10026, "获取企业微信token失败"),
    QY_WECHAT_GET_DATA_FAIL(10027, "企业微信获取数据失败"),
    QY_WECHAT_PULL_USER_NOT_DUPLICATE_SUBMISSIONS(10028, "拉取任务正在执行，请勿重复提交"),

    WECHAT_MP_API_ERROR(10030, "微信公众号接口调用失败"),
    WECHAT_MP_NOT_SET(10031, "微信公众号息未设置"),
    WECHAT_MP_FILE_NOTE_FOUND(10032, "微信公众号文件不存在"),
    WECHAT_MP_CHECK_FILE_NOTE_FOUND(10033, "微信公众号校验文件不存在"),

    PROJECT_CHECK_FILE_NOTE_FOUND(10040, "校验文件不存在"),
    PROJECT_FILE_NOTE_FOUND(10041, "上传的文件不存在"),

    USER_HAD_BIND(10019, "该用户已被绑定"),
    ADMIN_NOT_FOUND(10020, "未找到管理员"),

    WECHAT_CREATE_QR_CODE_EXCEPTION(10060, "生成小程序码异常"),
    WECHAT_CREATE_MINI_CODE_EXCEPTION(10061, "生成二维码异常"),
    WECHAT_MINI_LOGIN_ERROR(10062, "微信小程序登录失败"),
    WECHAT_MINI_NOT_SETTING(10063, "微信小程序未配置"),
    DEPARTMENT_TYPE_NOT_FOUND(10101, "未找到该部门类型"),

    USER_IS_REGISTERED(10064,"用户已注册过，不能重复注册"),
    USER_MESSAGE_DEPARTMENT_REL_NOT_FOUND(10065,"未找到该人员资料与部门关系"),

    USER_MESSAGE_PHONE_CANNOT_BE_REPEATED(10064, "人员资料手机号不能重复"),    //
    ;

    private int value;

    private String name;

    UserResultCode(int mode, String name) {
        this.value = mode;
        this.name = name;
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public String getName() {
        return name;
    }

    private static Map<Integer, UserResultCode> paramKeysMap;

    static {
        paramKeysMap = new HashMap<>();
        UserResultCode[] keys = UserResultCode.values();
        for (UserResultCode key : keys) {
            paramKeysMap.put(key.getValue(), key);
        }
    }

    public static UserResultCode get(int code) {
        return paramKeysMap.get(code);
    }
}


